#!/usr/bin/python
# -*- coding: us-ascii -*-
# vim:ts=4:sw=4:softtabstop=0:smarttab

"""
Import test cases
-----------------

Thise test cases are samples to be imported by the test case importer. They
don't actually do anything else. It specifically tests for multiple prerequisites.
"""

from pycopia.QA import core


class SampleTestOne(core.Test):
    """
    Purpose
    +++++++

    To be a sample test, first one.

    Pass Criteria
    +++++++++++++

    This should get imported.

    Start Condition
    +++++++++++++++

    Not imported.

    End Condition
    +++++++++++++

    The database will have a new TestCase showing this text.

    Reference
    +++++++++

    None

    Prerequisites
    +++++++++++++

    None

    Procedure
    +++++++++

    #. Run the test case importer.
    #. Verify this exists in the database.
    #. Remove it from the database after verifying.

    """

    def execute(self):
        return self.passed()


class SampleTestTwo(core.Test):
    """
    Purpose
    +++++++

    To be a sample test, second one.

    Pass Criteria
    +++++++++++++

    This should get imported.

    Start Condition
    +++++++++++++++

    Not imported.

    End Condition
    +++++++++++++

    The database will have a new TestCase showing this other text.

    Reference
    +++++++++

    None

    Prerequisites
    +++++++++++++

    None

    Procedure
    +++++++++

    #. Run the test case importer.
    #. Verify this exists in the database.
    #. Remove it from the database after verifying.

    """

    def execute(self):
        return self.passed()


class SampleDependentTest(core.Test):
    """
    Purpose
    +++++++

    Example test that requires two other tests to pass first.

    Pass Criteria
    +++++++++++++

    This should be imported with two prerequisites linked in the database.

    Start Condition
    +++++++++++++++

    Not imported.

    End Condition
    +++++++++++++

    The database will have a new TestCase with two prerequisites.

    Reference
    +++++++++

    None

    Prerequisites
    +++++++++++++

    SampleTestOne
    SampleTestTwo

    Procedure
    +++++++++

    #. Run the test case importer.
    #. Verify this exists in the database.
    #. Remove it from the database after verifying.

    """

    PREREQUISITES = ["SampleTestOne", "SampleTestTwo"]

    def execute(self):
        return self.passed()



def get_suite(config):
    suite = core.TestSuite(config, name="MyNewSuite")
    suite.add_test(SampleTestOne)
    suite.add_test(SampleTestTwo)
    suite.add_test(SampleDependentTest)
    return suite

def run(config):
    suite = get_suite(config)
    suite.run()

